package FileCoding.Exa4;

import java.io.*;

/**
 * 设置文件属性
 * 我们可以通过系统命令实现，在Java中，可以通过Runtime类实现操作系统命令的执行
 */
public class CoreCoding {

    public static void main(String[] args) throws IOException {
        File file = new File("Flag_Feedback.png");
        //获取Runtime实例
        Runtime runtime=Runtime.getRuntime();
        System.out.println(file.getAbsolutePath());
        Process process = runtime.exec("cmd /c dir "+file.getAbsolutePath());
        InputStream inputStream=process.getInputStream();
        InputStreamReader inputStreamReader=new InputStreamReader(inputStream,"GBK");
        BufferedReader reader=new BufferedReader(inputStreamReader);
        while (true){
            String line=reader.readLine();
            if(line!=null){
                System.out.println(line);
            }else{
                break;
            }
        }
        reader.close();
    }

}
